package com.example.farmeworkgetdataserverjson;

import java.util.ArrayList;

import com.hoangkien.config.Core;
import com.hoangkien.network.response.Promotion;
import com.hoangkien.util.Listener;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

public class MainActivity extends Activity {
	MainListener listener = new MainListener();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		Core.getInstance(MainActivity.this).taskGetListPromotions(10, 1, listener);
	}

	class MainListener extends Listener {
		@Override
		public void finishGetListPromos(int returnCode, int pageCount, final ArrayList<Promotion> arrayList) {
			super.finishGetListPromos(returnCode, pageCount, arrayList);
			runOnUiThread(new Runnable() {
				@Override
				public void run() {
					Log.e("MainActivity", arrayList.size()+" aaa");
					Toast.makeText(MainActivity.this, arrayList.size()+" aa", Toast.LENGTH_SHORT).show();
				}
			});
		}
	}

}
